.class public Lcn/sharesdk/framework/b/b;
.super Landroid/os/HandlerThread;

# interfaces
.implements Landroid/os/Handler$Callback;


# static fields
.field private static a:Lcn/sharesdk/framework/b/b;


# instance fields
.field private b:Landroid/content/Context;

.field private c:Lcn/sharesdk/framework/utils/b;

.field private d:Ljava/lang/String;

.field private e:Z

.field private f:Landroid/os/Handler;

.field private g:Landroid/os/Handler;

.field private h:J

.field private i:Z


# direct methods
.method private constructor <init>(Landroid/content/Context;)V
    .registers 4

    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    const-string v1, "Thread-"

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    const/16 v1, -0x5303

    invoke-static {v1}, Ljava/lang/Math;->abs(I)I

    move-result v1

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-direct {p0, v0}, Landroid/os/HandlerThread;-><init>(Ljava/lang/String;)V

    iput-object p1, p0, Lcn/sharesdk/framework/b/b;->b:Landroid/content/Context;

    invoke-static {p1}, Lcn/sharesdk/framework/utils/b;->a(Landroid/content/Context;)Lcn/sharesdk/framework/utils/b;

    move-result-object v0

    iput-object v0, p0, Lcn/sharesdk/framework/b/b;->c:Lcn/sharesdk/framework/utils/b;

    return-void
.end method

.method public static declared-synchronized a(Landroid/content/Context;)Lcn/sharesdk/framework/b/b;
    .registers 4

    const-class v1, Lcn/sharesdk/framework/b/b;

    monitor-enter v1

    :try_start_3
    sget-object v0, Lcn/sharesdk/framework/b/b;->a:Lcn/sharesdk/framework/b/b;
    :try_end_5
    .catchall {:try_start_3 .. :try_end_5} :catchall_1a

    if-nez v0, :cond_17

    if-nez p0, :cond_c

    const/4 v0, 0x0

    :goto_a
    monitor-exit v1

    return-object v0

    :cond_c
    :try_start_c
    new-instance v0, Lcn/sharesdk/framework/b/b;

    invoke-virtual {p0}, Landroid/content/Context;->getApplicationContext()Landroid/content/Context;

    move-result-object v2

    invoke-direct {v0, v2}, Lcn/sharesdk/framework/b/b;-><init>(Landroid/content/Context;)V

    sput-object v0, Lcn/sharesdk/framework/b/b;->a:Lcn/sharesdk/framework/b/b;

    :cond_17
    sget-object v0, Lcn/sharesdk/framework/b/b;->a:Lcn/sharesdk/framework/b/b;
    :try_end_19
    .catchall {:try_start_c .. :try_end_19} :catchall_1a

    goto :goto_a

    :catchall_1a
    move-exception v0

    monitor-exit v1

    throw v0
.end method

.method private b()V
    .registers 5

    invoke-direct {p0}, Lcn/sharesdk/framework/b/b;->c()Z

    move-result v0

    if-eqz v0, :cond_1b

    iget-boolean v1, p0, Lcn/sharesdk/framework/b/b;->i:Z

    if-nez v1, :cond_1a

    iput-boolean v0, p0, Lcn/sharesdk/framework/b/b;->i:Z

    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v0

    iput-wide v0, p0, Lcn/sharesdk/framework/b/b;->h:J

    new-instance v0, Lcn/sharesdk/framework/b/b/g;

    invoke-direct {v0}, Lcn/sharesdk/framework/b/b/g;-><init>()V

    invoke-virtual {p0, v0}, Lcn/sharesdk/framework/b/b;->a(Lcn/sharesdk/framework/b/b/c;)V

    :cond_1a
    :goto_1a
    return-void

    :cond_1b
    iget-boolean v1, p0, Lcn/sharesdk/framework/b/b;->i:Z

    if-eqz v1, :cond_1a

    iput-boolean v0, p0, Lcn/sharesdk/framework/b/b;->i:Z

    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v0

    iget-wide v2, p0, Lcn/sharesdk/framework/b/b;->h:J

    sub-long/2addr v0, v2

    new-instance v2, Lcn/sharesdk/framework/b/b/e;

    invoke-direct {v2}, Lcn/sharesdk/framework/b/b/e;-><init>()V

    iput-wide v0, v2, Lcn/sharesdk/framework/b/b/e;->a:J

    invoke-virtual {p0, v2}, Lcn/sharesdk/framework/b/b;->a(Lcn/sharesdk/framework/b/b/c;)V

    goto :goto_1a
.end method

.method private b(Lcn/sharesdk/framework/b/b/c;)V
    .registers 4

    iget-object v0, p0, Lcn/sharesdk/framework/b/b;->c:Lcn/sharesdk/framework/utils/b;

    invoke-virtual {v0}, Lcn/sharesdk/framework/utils/b;->o()Ljava/lang/String;

    move-result-object v0

    iput-object v0, p1, Lcn/sharesdk/framework/b/b/c;->f:Ljava/lang/String;

    iget-object v0, p0, Lcn/sharesdk/framework/b/b;->d:Ljava/lang/String;

    iput-object v0, p1, Lcn/sharesdk/framework/b/b/c;->g:Ljava/lang/String;

    iget-object v0, p0, Lcn/sharesdk/framework/b/b;->c:Lcn/sharesdk/framework/utils/b;

    invoke-virtual {v0}, Lcn/sharesdk/framework/utils/b;->p()Ljava/lang/String;

    move-result-object v0

    iput-object v0, p1, Lcn/sharesdk/framework/b/b/c;->h:Ljava/lang/String;

    iget-object v0, p0, Lcn/sharesdk/framework/b/b;->c:Lcn/sharesdk/framework/utils/b;

    invoke-virtual {v0}, Lcn/sharesdk/framework/utils/b;->r()I

    move-result v0

    iput v0, p1, Lcn/sharesdk/framework/b/b/c;->i:I

    invoke-static {}, Lcn/sharesdk/framework/ShareSDK;->getSDKVersionCode()I

    move-result v0

    add-int/lit16 v0, v0, 0x4e20

    invoke-static {v0}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;

    move-result-object v0

    iput-object v0, p1, Lcn/sharesdk/framework/b/b/c;->j:Ljava/lang/String;

    iget-object v0, p0, Lcn/sharesdk/framework/b/b;->c:Lcn/sharesdk/framework/utils/b;

    invoke-virtual {v0}, Lcn/sharesdk/framework/utils/b;->m()I

    move-result v0

    iput v0, p1, Lcn/sharesdk/framework/b/b/c;->k:I

    iget-object v0, p0, Lcn/sharesdk/framework/b/b;->c:Lcn/sharesdk/framework/utils/b;

    invoke-virtual {v0}, Lcn/sharesdk/framework/utils/b;->l()Ljava/lang/String;

    move-result-object v0

    iput-object v0, p1, Lcn/sharesdk/framework/b/b/c;->l:Ljava/lang/String;

    const-string v0, "cn.sharesdk.demo"

    iget-object v1, p1, Lcn/sharesdk/framework/b/b/c;->h:Ljava/lang/String;

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-nez v0, :cond_59

    const-string v0, "api20"

    iget-object v1, p0, Lcn/sharesdk/framework/b/b;->d:Ljava/lang/String;

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_59

    invoke-static {}, Lcn/sharesdk/framework/ShareSDK;->isDebug()Z

    move-result v0

    if-eqz v0, :cond_59

    sget-object v0, Ljava/lang/System;->err:Ljava/io/PrintStream;

    const-string v1, "Your application is using the appkey of ShareSDK Demo, this will cause its data won\'t be count!"

    invoke-virtual {v0, v1}, Ljava/io/PrintStream;->println(Ljava/lang/String;)V

    :cond_59
    iget-object v0, p0, Lcn/sharesdk/framework/b/b;->c:Lcn/sharesdk/framework/utils/b;

    invoke-virtual {v0}, Lcn/sharesdk/framework/utils/b;->e()Ljava/lang/String;

    move-result-object v0

    iput-object v0, p1, Lcn/sharesdk/framework/b/b/c;->m:Ljava/lang/String;

    return-void
.end method

.method private c(Lcn/sharesdk/framework/b/b/c;)V
    .registers 4

    :try_start_0
    iget-object v0, p0, Lcn/sharesdk/framework/b/b;->b:Landroid/content/Context;

    invoke-static {v0}, Lcn/sharesdk/framework/b/a;->a(Landroid/content/Context;)Lcn/sharesdk/framework/b/a;

    move-result-object v0

    invoke-virtual {v0, p1}, Lcn/sharesdk/framework/b/a;->a(Lcn/sharesdk/framework/b/b/c;)V

    iget-object v0, p0, Lcn/sharesdk/framework/b/b;->b:Landroid/content/Context;

    invoke-virtual {p1, v0}, Lcn/sharesdk/framework/b/b/c;->b(Landroid/content/Context;)V
    :try_end_e
    .catch Ljava/lang/Throwable; {:try_start_0 .. :try_end_e} :catch_f

    :goto_e
    return-void

    :catch_f
    move-exception v0

    invoke-static {v0}, Lcn/sharesdk/framework/utils/e;->b(Ljava/lang/Throwable;)I

    invoke-virtual {p1}, Lcn/sharesdk/framework/b/b/c;->toString()Ljava/lang/String;

    move-result-object v0

    const/4 v1, 0x0

    new-array v1, v1, [Ljava/lang/Object;

    invoke-static {v0, v1}, Lcn/sharesdk/framework/utils/e;->c(Ljava/lang/Object;[Ljava/lang/Object;)I

    goto :goto_e
.end method

.method private c()Z
    .registers 3

    iget-object v0, p0, Lcn/sharesdk/framework/b/b;->b:Landroid/content/Context;

    invoke-static {v0}, Lcn/sharesdk/framework/utils/b;->a(Landroid/content/Context;)Lcn/sharesdk/framework/utils/b;

    move-result-object v0

    invoke-virtual {v0}, Lcn/sharesdk/framework/utils/b;->u()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0}, Lcn/sharesdk/framework/utils/b;->p()Ljava/lang/String;

    move-result-object v0

    if-eqz v0, :cond_18

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_18

    const/4 v0, 0x1

    :goto_17
    return v0

    :cond_18
    const/4 v0, 0x0

    goto :goto_17
.end method

.method private d()V
    .registers 2

    :try_start_0
    iget-object v0, p0, Lcn/sharesdk/framework/b/b;->b:Landroid/content/Context;

    invoke-static {v0}, Lcn/sharesdk/framework/b/a;->a(Landroid/content/Context;)Lcn/sharesdk/framework/b/a;

    move-result-object v0

    invoke-virtual {v0}, Lcn/sharesdk/framework/b/a;->b()V
    :try_end_9
    .catch Ljava/lang/Throwable; {:try_start_0 .. :try_end_9} :catch_a

    :goto_9
    return-void

    :catch_a
    move-exception v0

    invoke-static {v0}, Lcn/sharesdk/framework/utils/e;->b(Ljava/lang/Throwable;)I

    goto :goto_9
.end method


# virtual methods
.method public declared-synchronized a()V
    .registers 5

    monitor-enter p0

    :try_start_1
    iget-boolean v0, p0, Lcn/sharesdk/framework/b/b;->e:Z

    if-eqz v0, :cond_29

    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v0

    iget-wide v2, p0, Lcn/sharesdk/framework/b/b;->h:J

    sub-long/2addr v0, v2

    new-instance v2, Lcn/sharesdk/framework/b/b/e;

    invoke-direct {v2}, Lcn/sharesdk/framework/b/b/e;-><init>()V

    iput-wide v0, v2, Lcn/sharesdk/framework/b/b/e;->a:J

    invoke-virtual {p0, v2}, Lcn/sharesdk/framework/b/b;->a(Lcn/sharesdk/framework/b/b/c;)V

    const/4 v0, 0x0

    iput-boolean v0, p0, Lcn/sharesdk/framework/b/b;->e:Z
    :try_end_19
    .catchall {:try_start_1 .. :try_end_19} :catchall_30

    :try_start_19
    iget-object v0, p0, Lcn/sharesdk/framework/b/b;->f:Landroid/os/Handler;

    const/4 v1, 0x2

    invoke-virtual {v0, v1}, Landroid/os/Handler;->sendEmptyMessage(I)Z
    :try_end_1f
    .catch Ljava/lang/Throwable; {:try_start_19 .. :try_end_1f} :catch_2b
    .catchall {:try_start_19 .. :try_end_1f} :catchall_30

    :goto_1f
    :try_start_1f
    invoke-virtual {p0}, Lcn/sharesdk/framework/b/b;->getLooper()Landroid/os/Looper;

    move-result-object v0

    invoke-virtual {v0}, Landroid/os/Looper;->quit()V

    const/4 v0, 0x0

    sput-object v0, Lcn/sharesdk/framework/b/b;->a:Lcn/sharesdk/framework/b/b;
    :try_end_29
    .catchall {:try_start_1f .. :try_end_29} :catchall_30

    :cond_29
    monitor-exit p0

    return-void

    :catch_2b
    move-exception v0

    :try_start_2c
    invoke-static {v0}, Lcn/sharesdk/framework/utils/e;->b(Ljava/lang/Throwable;)I
    :try_end_2f
    .catchall {:try_start_2c .. :try_end_2f} :catchall_30

    goto :goto_1f

    :catchall_30
    move-exception v0

    monitor-exit p0

    throw v0
.end method

.method public declared-synchronized a(Landroid/os/Handler;Z)V
    .registers 5

    monitor-enter p0

    :try_start_1
    iget-boolean v0, p0, Lcn/sharesdk/framework/b/b;->e:Z

    if-nez v0, :cond_33

    iget-object v0, p0, Lcn/sharesdk/framework/b/b;->b:Landroid/content/Context;

    invoke-static {v0}, Lcn/sharesdk/framework/b/a;->a(Landroid/content/Context;)Lcn/sharesdk/framework/b/a;

    move-result-object v0

    invoke-virtual {v0, p2}, Lcn/sharesdk/framework/b/a;->a(Z)V

    const/4 v0, 0x1

    iput-boolean v0, p0, Lcn/sharesdk/framework/b/b;->e:Z

    invoke-super {p0}, Landroid/os/HandlerThread;->start()V

    iput-object p1, p0, Lcn/sharesdk/framework/b/b;->f:Landroid/os/Handler;

    new-instance v0, Landroid/os/Handler;

    invoke-virtual {p0}, Lcn/sharesdk/framework/b/b;->getLooper()Landroid/os/Looper;

    move-result-object v1

    invoke-direct {v0, v1, p0}, Landroid/os/Handler;-><init>(Landroid/os/Looper;Landroid/os/Handler$Callback;)V

    iput-object v0, p0, Lcn/sharesdk/framework/b/b;->g:Landroid/os/Handler;

    iget-object v0, p0, Lcn/sharesdk/framework/b/b;->g:Landroid/os/Handler;

    const/4 v1, 0x1

    invoke-virtual {v0, v1}, Landroid/os/Handler;->sendEmptyMessage(I)Z

    iget-object v0, p0, Lcn/sharesdk/framework/b/b;->g:Landroid/os/Handler;

    const/4 v1, 0x3

    invoke-virtual {v0, v1}, Landroid/os/Handler;->sendEmptyMessage(I)Z

    iget-object v0, p0, Lcn/sharesdk/framework/b/b;->g:Landroid/os/Handler;

    const/4 v1, 0x4

    invoke-virtual {v0, v1}, Landroid/os/Handler;->sendEmptyMessage(I)Z
    :try_end_33
    .catchall {:try_start_1 .. :try_end_33} :catchall_35

    :cond_33
    monitor-exit p0

    return-void

    :catchall_35
    move-exception v0

    monitor-exit p0

    throw v0
.end method

.method public a(Lcn/sharesdk/framework/b/b/c;)V
    .registers 4

    iget-boolean v0, p0, Lcn/sharesdk/framework/b/b;->e:Z

    if-eqz v0, :cond_1e

    invoke-direct {p0, p1}, Lcn/sharesdk/framework/b/b;->b(Lcn/sharesdk/framework/b/b/c;)V

    iget-object v0, p0, Lcn/sharesdk/framework/b/b;->b:Landroid/content/Context;

    invoke-virtual {p1, v0}, Lcn/sharesdk/framework/b/b/c;->a(Landroid/content/Context;)Z

    move-result v0

    if-eqz v0, :cond_24

    new-instance v0, Landroid/os/Message;

    invoke-direct {v0}, Landroid/os/Message;-><init>()V

    const/4 v1, 0x2

    iput v1, v0, Landroid/os/Message;->what:I

    iput-object p1, v0, Landroid/os/Message;->obj:Ljava/lang/Object;

    :try_start_19
    iget-object v1, p0, Lcn/sharesdk/framework/b/b;->g:Landroid/os/Handler;

    invoke-virtual {v1, v0}, Landroid/os/Handler;->sendMessage(Landroid/os/Message;)Z
    :try_end_1e
    .catch Ljava/lang/Throwable; {:try_start_19 .. :try_end_1e} :catch_1f

    :cond_1e
    :goto_1e
    return-void

    :catch_1f
    move-exception v0

    invoke-static {v0}, Lcn/sharesdk/framework/utils/e;->b(Ljava/lang/Throwable;)I

    goto :goto_1e

    :cond_24
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    const-string v1, "Drop event: "

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {p1}, Lcn/sharesdk/framework/b/b/c;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    const/4 v1, 0x0

    new-array v1, v1, [Ljava/lang/Object;

    invoke-static {v0, v1}, Lcn/sharesdk/framework/utils/e;->a(Ljava/lang/Object;[Ljava/lang/Object;)I

    goto :goto_1e
.end method

.method public a(Ljava/lang/String;)V
    .registers 2

    iput-object p1, p0, Lcn/sharesdk/framework/b/b;->d:Ljava/lang/String;

    return-void
.end method

.method public handleMessage(Landroid/os/Message;)Z
    .registers 6

    iget v0, p1, Landroid/os/Message;->what:I

    packed-switch v0, :pswitch_data_38

    :cond_5
    :goto_5
    const/4 v0, 0x0

    return v0

    :pswitch_7
    iget-object v0, p0, Lcn/sharesdk/framework/b/b;->b:Landroid/content/Context;

    invoke-static {v0}, Lcn/sharesdk/framework/b/a;->a(Landroid/content/Context;)Lcn/sharesdk/framework/b/a;

    move-result-object v0

    iget-object v1, p0, Lcn/sharesdk/framework/b/b;->d:Ljava/lang/String;

    invoke-virtual {v0, v1}, Lcn/sharesdk/framework/b/a;->a(Ljava/lang/String;)J

    goto :goto_5

    :pswitch_13
    iget-object v0, p1, Landroid/os/Message;->obj:Ljava/lang/Object;

    if-eqz v0, :cond_5

    iget-object v0, p1, Landroid/os/Message;->obj:Ljava/lang/Object;

    check-cast v0, Lcn/sharesdk/framework/b/b/c;

    invoke-direct {p0, v0}, Lcn/sharesdk/framework/b/b;->c(Lcn/sharesdk/framework/b/b/c;)V

    goto :goto_5

    :pswitch_1f
    invoke-direct {p0}, Lcn/sharesdk/framework/b/b;->b()V

    iget-object v0, p0, Lcn/sharesdk/framework/b/b;->g:Landroid/os/Handler;

    const/4 v1, 0x3

    const-wide/16 v2, 0x64

    invoke-virtual {v0, v1, v2, v3}, Landroid/os/Handler;->sendEmptyMessageDelayed(IJ)Z

    goto :goto_5

    :pswitch_2b
    invoke-direct {p0}, Lcn/sharesdk/framework/b/b;->d()V

    iget-object v0, p0, Lcn/sharesdk/framework/b/b;->g:Landroid/os/Handler;

    const/4 v1, 0x4

    const-wide/16 v2, 0x2710

    invoke-virtual {v0, v1, v2, v3}, Landroid/os/Handler;->sendEmptyMessageDelayed(IJ)Z

    goto :goto_5

    nop

    :pswitch_data_38
    .packed-switch 0x1
        :pswitch_7
        :pswitch_13
        :pswitch_1f
        :pswitch_2b
    .end packed-switch
.end method
